home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / dierol1a / dierolle.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-10-08  |  26.3 KB  |  836 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form Form1 
  4.    BackColor       =   &H00C00000&
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   " Die Roller"
  7.    ClientHeight    =   4725
  8.    ClientLeft      =   150
  9.    ClientTop       =   435
  10.    ClientWidth     =   6345
  11.    Icon            =   "DieRoller_Frm.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4725
  16.    ScaleWidth      =   6345
  17.    StartUpPosition =   2  'CenterScreen
  18.    Begin MSComDlg.CommonDialog CommonDialog1 
  19.       Left            =   2775
  20.       Top             =   2160
  21.       _ExtentX        =   847
  22.       _ExtentY        =   847
  23.       _Version        =   393216
  24.    End
  25.    Begin VB.CommandButton Command3 
  26.       Appearance      =   0  'Flat
  27.       BackColor       =   &H00C0C0C0&
  28.       Caption         =   "Roll"
  29.       Height          =   375
  30.       Index           =   7
  31.       Left            =   915
  32.       Style           =   1  'Graphical
  33.       TabIndex        =   33
  34.       Top             =   4320
  35.       Width           =   495
  36.    End
  37.    Begin VB.CommandButton Command3 
  38.       Appearance      =   0  'Flat
  39.       BackColor       =   &H00C0C0C0&
  40.       Caption         =   "Roll"
  41.       Height          =   375
  42.       Index           =   6
  43.       Left            =   915
  44.       Style           =   1  'Graphical
  45.       TabIndex        =   32
  46.       Top             =   3720
  47.       Width           =   495
  48.    End
  49.    Begin VB.CommandButton Command3 
  50.       Appearance      =   0  'Flat
  51.       BackColor       =   &H00C0C0C0&
  52.       Caption         =   "Roll"
  53.       Height          =   375
  54.       Index           =   5
  55.       Left            =   915
  56.       Style           =   1  'Graphical
  57.       TabIndex        =   31
  58.       Top             =   3120
  59.       Width           =   495
  60.    End
  61.    Begin VB.CommandButton Command3 
  62.       Appearance      =   0  'Flat
  63.       BackColor       =   &H00C0C0C0&
  64.       Caption         =   "Roll"
  65.       Height          =   375
  66.       Index           =   4
  67.       Left            =   915
  68.       Style           =   1  'Graphical
  69.       TabIndex        =   30
  70.       Top             =   2520
  71.       Width           =   495
  72.    End
  73.    Begin VB.CommandButton Command3 
  74.       Appearance      =   0  'Flat
  75.       BackColor       =   &H00C0C0C0&
  76.       Caption         =   "Roll"
  77.       Height          =   375
  78.       Index           =   3
  79.       Left            =   915
  80.       Style           =   1  'Graphical
  81.       TabIndex        =   29
  82.       Top             =   1920
  83.       Width           =   495
  84.    End
  85.    Begin VB.CommandButton Command3 
  86.       Appearance      =   0  'Flat
  87.       BackColor       =   &H00C0C0C0&
  88.       Caption         =   "Roll"
  89.       Height          =   375
  90.       Index           =   2
  91.       Left            =   915
  92.       Style           =   1  'Graphical
  93.       TabIndex        =   28
  94.       Top             =   1320
  95.       Width           =   495
  96.    End
  97.    Begin VB.CommandButton Command3 
  98.       Appearance      =   0  'Flat
  99.       BackColor       =   &H00C0C0C0&
  100.       Caption         =   "Roll"
  101.       Height          =   375
  102.       Index           =   1
  103.       Left            =   915
  104.       Style           =   1  'Graphical
  105.       TabIndex        =   27
  106.       Top             =   720
  107.       Width           =   495
  108.    End
  109.    Begin VB.CommandButton Command3 
  110.       Appearance      =   0  'Flat
  111.       BackColor       =   &H00C0C0C0&
  112.       Caption         =   "Roll"
  113.       Height          =   375
  114.       Index           =   0
  115.       Left            =   915
  116.       Style           =   1  'Graphical
  117.       TabIndex        =   26
  118.       Top             =   120
  119.       Width           =   495
  120.    End
  121.    Begin VB.CommandButton Command2 
  122.       Appearance      =   0  'Flat
  123.       BackColor       =   &H00C0C0C0&
  124.       Caption         =   "-"
  125.       BeginProperty Font 
  126.          Name            =   "MS Sans Serif"
  127.          Size            =   8.25
  128.          Charset         =   0
  129.          Weight          =   700
  130.          Underline       =   0   'False
  131.          Italic          =   0   'False
  132.          Strikethrough   =   0   'False
  133.       EndProperty
  134.       Height          =   195
  135.       Index           =   7
  136.       Left            =   675
  137.       Style           =   1  'Graphical
  138.       TabIndex        =   25
  139.       Top             =   4515
  140.       Width           =   195
  141.    End
  142.    Begin VB.CommandButton Command1 
  143.       Appearance      =   0  'Flat
  144.       BackColor       =   &H00C0C0C0&
  145.       Caption         =   "+"
  146.       Height          =   195
  147.       Index           =   7
  148.       Left            =   675
  149.       Style           =   1  'Graphical
  150.       TabIndex        =   24
  151.       Top             =   4320
  152.       Width           =   195
  153.    End
  154.    Begin VB.CommandButton Command2 
  155.       Appearance      =   0  'Flat
  156.       BackColor       =   &H00C0C0C0&
  157.       Caption         =   "-"
  158.       BeginProperty Font 
  159.          Name            =   "MS Sans Serif"
  160.          Size            =   8.25
  161.          Charset         =   0
  162.          Weight          =   700
  163.          Underline       =   0   'False
  164.          Italic          =   0   'False
  165.          Strikethrough   =   0   'False
  166.       EndProperty
  167.       Height          =   195
  168.       Index           =   6
  169.       Left            =   675
  170.       Style           =   1  'Graphical
  171.       TabIndex        =   23
  172.       Top             =   3915
  173.       Width           =   195
  174.    End
  175.    Begin VB.CommandButton Command1 
  176.       Appearance      =   0  'Flat
  177.       BackColor       =   &H00C0C0C0&
  178.       Caption         =   "+"
  179.       Height          =   195
  180.       Index           =   6
  181.       Left            =   675
  182.       Style           =   1  'Graphical
  183.       TabIndex        =   22
  184.       Top             =   3720
  185.       Width           =   195
  186.    End
  187.    Begin VB.CommandButton Command2 
  188.       Appearance      =   0  'Flat
  189.       BackColor       =   &H00C0C0C0&
  190.       Caption         =   "-"
  191.       BeginProperty Font 
  192.          Name            =   "MS Sans Serif"
  193.          Size            =   8.25
  194.          Charset         =   0
  195.          Weight          =   700
  196.          Underline       =   0   'False
  197.          Italic          =   0   'False
  198.          Strikethrough   =   0   'False
  199.       EndProperty
  200.       Height          =   195
  201.       Index           =   5
  202.       Left            =   675
  203.       Style           =   1  'Graphical
  204.       TabIndex        =   21
  205.       Top             =   3315
  206.       Width           =   195
  207.    End
  208.    Begin VB.CommandButton Command1 
  209.       Appearance      =   0  'Flat
  210.       BackColor       =   &H00C0C0C0&
  211.       Caption         =   "+"
  212.       Height          =   195
  213.       Index           =   5
  214.       Left            =   675
  215.       Style           =   1  'Graphical
  216.       TabIndex        =   20
  217.       Top             =   3120
  218.       Width           =   195
  219.    End
  220.    Begin VB.CommandButton Command2 
  221.       Appearance      =   0  'Flat
  222.       BackColor       =   &H00C0C0C0&
  223.       Caption         =   "-"
  224.       BeginProperty Font 
  225.          Name            =   "MS Sans Serif"
  226.          Size            =   8.25
  227.          Charset         =   0
  228.          Weight          =   700
  229.          Underline       =   0   'False
  230.          Italic          =   0   'False
  231.          Strikethrough   =   0   'False
  232.       EndProperty
  233.       Height          =   195
  234.       Index           =   4
  235.       Left            =   675
  236.       Style           =   1  'Graphical
  237.       TabIndex        =   19
  238.       Top             =   2715
  239.       Width           =   195
  240.    End
  241.    Begin VB.CommandButton Command1 
  242.       Appearance      =   0  'Flat
  243.       BackColor       =   &H00C0C0C0&
  244.       Caption         =   "+"
  245.       Height          =   195
  246.       Index           =   4
  247.       Left            =   675
  248.       Style           =   1  'Graphical
  249.       TabIndex        =   18
  250.       Top             =   2520
  251.       Width           =   195
  252.    End
  253.    Begin VB.CommandButton Command2 
  254.       Appearance      =   0  'Flat
  255.       BackColor       =   &H00C0C0C0&
  256.       Caption         =   "-"
  257.       BeginProperty Font 
  258.          Name            =   "MS Sans Serif"
  259.          Size            =   8.25
  260.          Charset         =   0
  261.          Weight          =   700
  262.          Underline       =   0   'False
  263.          Italic          =   0   'False
  264.          Strikethrough   =   0   'False
  265.       EndProperty
  266.       Height          =   195
  267.       Index           =   3
  268.       Left            =   675
  269.       Style           =   1  'Graphical
  270.       TabIndex        =   17
  271.       Top             =   2115
  272.       Width           =   195
  273.    End
  274.    Begin VB.CommandButton Command1 
  275.       Appearance      =   0  'Flat
  276.       BackColor       =   &H00C0C0C0&
  277.       Caption         =   "+"
  278.       Height          =   195
  279.       Index           =   3
  280.       Left            =   675
  281.       Style           =   1  'Graphical
  282.       TabIndex        =   16
  283.       Top             =   1920
  284.       Width           =   195
  285.    End
  286.    Begin VB.CommandButton Command2 
  287.       Appearance      =   0  'Flat
  288.       BackColor       =   &H00C0C0C0&
  289.       Caption         =   "-"
  290.       BeginProperty Font 
  291.          Name            =   "MS Sans Serif"
  292.          Size            =   8.25
  293.          Charset         =   0
  294.          Weight          =   700
  295.          Underline       =   0   'False
  296.          Italic          =   0   'False
  297.          Strikethrough   =   0   'False
  298.       EndProperty
  299.       Height          =   195
  300.       Index           =   2
  301.       Left            =   675
  302.       Style           =   1  'Graphical
  303.       TabIndex        =   15
  304.       Top             =   1515
  305.       Width           =   195
  306.    End
  307.    Begin VB.CommandButton Command1 
  308.       Appearance      =   0  'Flat
  309.       BackColor       =   &H00C0C0C0&
  310.       Caption         =   "+"
  311.       Height          =   195
  312.       Index           =   2
  313.       Left            =   675
  314.       Style           =   1  'Graphical
  315.       TabIndex        =   14
  316.       Top             =   1320
  317.       Width           =   195
  318.    End
  319.    Begin VB.CommandButton Command2 
  320.       Appearance      =   0  'Flat
  321.       BackColor       =   &H00C0C0C0&
  322.       Caption         =   "-"
  323.       BeginProperty Font 
  324.          Name            =   "MS Sans Serif"
  325.          Size            =   8.25
  326.          Charset         =   0
  327.          Weight          =   700
  328.          Underline       =   0   'False
  329.          Italic          =   0   'False
  330.          Strikethrough   =   0   'False
  331.       EndProperty
  332.       Height          =   195
  333.       Index           =   1
  334.       Left            =   675
  335.       Style           =   1  'Graphical
  336.       TabIndex        =   13
  337.       Top             =   915
  338.       Width           =   195
  339.    End
  340.    Begin VB.CommandButton Command1 
  341.       Appearance      =   0  'Flat
  342.       BackColor       =   &H00C0C0C0&
  343.       Caption         =   "+"
  344.       Height          =   195
  345.       Index           =   1
  346.       Left            =   675
  347.       Style           =   1  'Graphical
  348.       TabIndex        =   12
  349.       Top             =   720
  350.       Width           =   195
  351.    End
  352.    Begin VB.CommandButton Command2 
  353.       Appearance      =   0  'Flat
  354.       BackColor       =   &H00C0C0C0&
  355.       Caption         =   "-"
  356.       BeginProperty Font 
  357.          Name            =   "MS Sans Serif"
  358.          Size            =   8.25
  359.          Charset         =   0
  360.          Weight          =   700
  361.          Underline       =   0   'False
  362.          Italic          =   0   'False
  363.          Strikethrough   =   0   'False
  364.       EndProperty
  365.       Height          =   195
  366.       Index           =   0
  367.       Left            =   675
  368.       Style           =   1  'Graphical
  369.       TabIndex        =   11
  370.       Top             =   315
  371.       Width           =   195
  372.    End
  373.    Begin VB.CommandButton Command1 
  374.       Appearance      =   0  'Flat
  375.       BackColor       =   &H00C0C0C0&
  376.       Caption         =   "+"
  377.       Height          =   195
  378.       Index           =   0
  379.       Left            =   675
  380.       Style           =   1  'Graphical
  381.       TabIndex        =   10
  382.       Top             =   120
  383.       Width           =   195
  384.    End
  385.    Begin VB.TextBox Txt_Result 
  386.       Appearance      =   0  'Flat
  387.       BorderStyle     =   0  'None
  388.       BeginProperty Font 
  389.          Name            =   "MS Sans Serif"
  390.          Size            =   12
  391.          Charset         =   0
  392.          Weight          =   400
  393.          Underline       =   0   'False
  394.          Italic          =   0   'False
  395.          Strikethrough   =   0   'False
  396.       EndProperty
  397.       Height          =   4545
  398.       Left            =   1470
  399.       Locked          =   -1  'True
  400.       MultiLine       =   -1  'True
  401.       ScrollBars      =   2  'Vertical
  402.       TabIndex        =   9
  403.       Top             =   120
  404.       Width           =   4815
  405.    End
  406.    Begin VB.Label Label1 
  407.       Alignment       =   1  'Right Justify
  408.       BackColor       =   &H00C00000&
  409.       Caption         =   "0"
  410.       ForeColor       =   &H00FFFFFF&
  411.       Height          =   195
  412.       Index           =   0
  413.       Left            =   285
  414.       TabIndex        =   0
  415.       Top             =   195
  416.       Width           =   150
  417.    End
  418.    Begin VB.Label Label1 
  419.       Alignment       =   1  'Right Justify
  420.       BackColor       =   &H00C00000&
  421.       Caption         =   "0"
  422.       ForeColor       =   &H00FFFFFF&
  423.       Height          =   195
  424.       Index           =   7
  425.       Left            =   90
  426.       TabIndex        =   40
  427.       Top             =   4395
  428.       Width           =   150
  429.    End
  430.    Begin VB.Label Label1 
  431.       Alignment       =   1  'Right Justify
  432.       BackColor       =   &H00C00000&
  433.       Caption         =   "0"
  434.       ForeColor       =   &H00FFFFFF&
  435.       Height          =   195
  436.       Index           =   6
  437.       Left            =   195
  438.       TabIndex        =   39
  439.       Top             =   3795
  440.       Width           =   150
  441.    End
  442.    Begin VB.Label Label1 
  443.       Alignment       =   1  'Right Justify
  444.       BackColor       =   &H00C00000&
  445.       Caption         =   "0"
  446.       ForeColor       =   &H00FFFFFF&
  447.       Height          =   195
  448.       Index           =   5
  449.       Left            =   195
  450.       TabIndex        =   38
  451.       Top             =   3195
  452.       Width           =   150
  453.    End
  454.    Begin VB.Label Label1 
  455.       Alignment       =   1  'Right Justify
  456.       BackColor       =   &H00C00000&
  457.       Caption         =   "0"
  458.       ForeColor       =   &H00FFFFFF&
  459.       Height          =   195
  460.       Index           =   4
  461.       Left            =   195
  462.       TabIndex        =   37
  463.       Top             =   2595
  464.       Width           =   150
  465.    End
  466.    Begin VB.Label Label1 
  467.       Alignment       =   1  'Right Justify
  468.       BackColor       =   &H00C00000&
  469.       Caption         =   "0"
  470.       ForeColor       =   &H00FFFFFF&
  471.       Height          =   195
  472.       Index           =   3
  473.       Left            =   195
  474.       TabIndex        =   36
  475.       Top             =   1995
  476.       Width           =   150
  477.    End
  478.    Begin VB.Label Label1 
  479.       Alignment       =   1  'Right Justify
  480.       BackColor       =   &H00C00000&
  481.       Caption         =   "0"
  482.       ForeColor       =   &H00FFFFFF&
  483.       Height          =   195
  484.       Index           =   2
  485.       Left            =   285
  486.       TabIndex        =   35
  487.       Top             =   1410
  488.       Width           =   150
  489.    End
  490.    Begin VB.Label Label1 
  491.       Alignment       =   1  'Right Justify
  492.       BackColor       =   &H00C00000&
  493.       Caption         =   "0"
  494.       ForeColor       =   &H00FFFFFF&
  495.       Height          =   195
  496.       Index           =   1
  497.       Left            =   285
  498.       TabIndex        =   34
  499.       Top             =   795
  500.       Width           =   150
  501.    End
  502.    Begin VB.Label Label2 
  503.       Alignment       =   1  'Right Justify
  504.       BackColor       =   &H00C00000&
  505.       Caption         =   "d12"
  506.       ForeColor       =   &H00FFFFFF&
  507.       Height          =   195
  508.       Index           =   4
  509.       Left            =   270
  510.       TabIndex        =   5
  511.       Top             =   2595
  512.       Width           =   360
  513.    End
  514.    Begin VB.Label Label2 
  515.       Alignment       =   1  'Right Justify
  516.       BackColor       =   &H00C00000&
  517.       Caption         =   "d20"
  518.       ForeColor       =   &H00FFFFFF&
  519.       Height          =   195
  520.       Index           =   5
  521.       Left            =   270
  522.       TabIndex        =   8
  523.       Top             =   3195
  524.       Width           =   360
  525.    End
  526.    Begin VB.Label Label2 
  527.       Alignment       =   1  'Right Justify
  528.       BackColor       =   &H00C00000&
  529.       Caption         =   "d30"
  530.       ForeColor       =   &H00FFFFFF&
  531.       Height          =   195
  532.       Index           =   6
  533.       Left            =   270
  534.       TabIndex        =   7
  535.       Top             =   3795
  536.       Width           =   360
  537.    End
  538.    Begin VB.Label Label2 
  539.       Alignment       =   1  'Right Justify
  540.       BackColor       =   &H00C00000&
  541.       Caption         =   "d100"
  542.       ForeColor       =   &H00FFFFFF&
  543.       Height          =   195
  544.       Index           =   7
  545.       Left            =   270
  546.       TabIndex        =   6
  547.       Top             =   4395
  548.       Width           =   360
  549.    End
  550.    Begin VB.Label Label2 
  551.       Alignment       =   1  'Right Justify
  552.       BackColor       =   &H00C00000&
  553.       Caption         =   "d10"
  554.       ForeColor       =   &H00FFFFFF&
  555.       Height          =   195
  556.       Index           =   3
  557.       Left            =   270
  558.       TabIndex        =   4
  559.       Top             =   1995
  560.       Width           =   360
  561.    End
  562.    Begin VB.Label Label2 
  563.       Alignment       =   1  'Right Justify
  564.       BackColor       =   &H00C00000&
  565.       Caption         =   "d8"
  566.       ForeColor       =   &H00FFFFFF&
  567.       Height          =   195
  568.       Index           =   2
  569.       Left            =   270
  570.       TabIndex        =   3
  571.       Top             =   1410
  572.       Width           =   360
  573.    End
  574.    Begin VB.Label Label2 
  575.       Alignment       =   1  'Right Justify
  576.       BackColor       =   &H00C00000&
  577.       Caption         =   "d4"
  578.       ForeColor       =   &H00FFFFFF&
  579.       Height          =   195
  580.       Index           =   0
  581.       Left            =   435
  582.       TabIndex        =   1
  583.       Top             =   195
  584.       Width           =   195
  585.    End
  586.    Begin VB.Label Label2 
  587.       Alignment       =   1  'Right Justify
  588.       BackColor       =   &H00C00000&
  589.       Caption         =   "d6"
  590.       ForeColor       =   &H00FFFFFF&
  591.       Height          =   195
  592.       Index           =   1
  593.       Left            =   270
  594.       TabIndex        =   2
  595.       Top             =   795
  596.       Width           =   360
  597.    End
  598.    Begin VB.Menu File 
  599.       Caption         =   "File"
  600.       Begin VB.Menu Save 
  601.          Caption         =   "&Save"
  602.          Shortcut        =   ^S
  603.       End
  604.       Begin VB.Menu Exit 
  605.          Caption         =   "E&xit"
  606.       End
  607.    End
  608.    Begin VB.Menu Tools 
  609.       Caption         =   "Tools"
  610.       Begin VB.Menu DieRoller 
  611.          Caption         =   "Get Die Totals"
  612.          Checked         =   -1  'True
  613.       End
  614.       Begin VB.Menu DieStats 
  615.          Caption         =   "Get Die Stats"
  616.       End
  617.    End
  618.    Begin VB.Menu NoofRolls 
  619.       Caption         =   "Number of Rolls"
  620.       Begin VB.Menu NoRolls 
  621.          Caption         =   "10"
  622.          Checked         =   -1  'True
  623.          Index           =   0
  624.       End
  625.       Begin VB.Menu NoRolls 
  626.          Caption         =   "20"
  627.          Index           =   1
  628.       End
  629.       Begin VB.Menu NoRolls 
  630.          Caption         =   "30"
  631.          Index           =   2
  632.       End
  633.       Begin VB.Menu NoRolls 
  634.          Caption         =   "40"
  635.          Index           =   3
  636.       End
  637.       Begin VB.Menu NoRolls 
  638.          Caption         =   "50"
  639.          Index           =   4
  640.       End
  641.       Begin VB.Menu NoRolls 
  642.          Caption         =   "60"
  643.          Index           =   5
  644.       End
  645.       Begin VB.Menu NoRolls 
  646.          Caption         =   "70"
  647.          Index           =   6
  648.       End
  649.       Begin VB.Menu NoRolls 
  650.          Caption         =   "80"
  651.          Index           =   7
  652.       End
  653.       Begin VB.Menu NoRolls 
  654.          Caption         =   "90"
  655.          Index           =   8
  656.       End
  657.       Begin VB.Menu NoRolls 
  658.          Caption         =   "100"
  659.          Index           =   9
  660.       End
  661.       Begin VB.Menu NoRolls 
  662.          Caption         =   "500"
  663.          Index           =   10
  664.       End
  665.    End
  666.    Begin VB.Menu Help 
  667.       Caption         =   "Help"
  668.       Begin VB.Menu About 
  669.          Caption         =   "&About"
  670.       End
  671.    End
  672. Attribute VB_Name = "Form1"
  673. Attribute VB_GlobalNameSpace = False
  674. Attribute VB_Creatable = False
  675. Attribute VB_PredeclaredId = True
  676. Attribute VB_Exposed = False
  677. Dim DefaultDir As String, FileNames As String
  678. Public Function FileRepExists(FileNames As String) As Boolean
  679. Dim val As Integer
  680. On Error Resume Next
  681. val = GetAttr(FileNames)
  682. FileRepExists = IIf(Err = 0, True, False)
  683. End Function
  684. Public Function GetRandomInteger(LowerBound, UpperBound) As Long
  685. 'Generate Random seed based upon time & Date
  686. Randomize Int(CDbl((Now))) + Timer
  687. GetRandomInteger = Int((UpperBound - LowerBound + 1) * Rnd + LowerBound)
  688. End Function
  689. Private Sub About_Click()
  690. Load frmAbout
  691. End Sub
  692. Private Sub Command1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  693. If val(Label1(Index)) <> 10 Then
  694.     Label1(Index).Caption = val(Label1(Index)) + 1
  695. End If
  696. End Sub
  697. Private Sub Command2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
  698. If val(Label1(Index)) <> 0 Then
  699.     Label1(Index).Caption = val(Label1(Index)) - 1
  700. End If
  701. End Sub
  702. Private Sub Command3_Click(Index As Integer)
  703. Dim Var As Integer, Total As Integer, NoRolless As String, NoRolles As Integer, Num As Integer, N As Integer, O As Integer, RI As Integer, Roll(4000), Rolls As String, Per As Double, Perc As String
  704. If Label1(Index).Caption = 0 Then Exit Sub
  705. Select Case Index
  706.     Case Is = 0
  707.         Var = 4
  708.     Case Is = 1
  709.         Var = 6
  710.     Case Is = 2
  711.         Var = 8
  712.     Case Is = 3
  713.         Var = 10
  714.     Case Is = 4
  715.         Var = 12
  716.     Case Is = 5
  717.         Var = 20
  718.     Case Is = 6
  719.         Var = 30
  720.     Case Is = 7
  721.         Var = 100
  722. End Select
  723. Txt_Result.Text = ""
  724. If DieRoller.Checked = True Then
  725.     For Num = 0 To 10
  726.         Select Case NoRolls(Num).Checked
  727.             Case Is = True
  728.                 For N = 1 To val(NoRolls(Num).Caption)
  729.                     If N < 10 Then Txt_Result.Text = Txt_Result.Text & "  "
  730.                     If N < 100 Then Txt_Result.Text = Txt_Result.Text & "  "
  731.                     Txt_Result.Text = Txt_Result.Text & N & ":  "
  732.                     Total = GetRandomInteger((Label1(Index).Caption), (Label1(Index).Caption) * Var) & vbNewLine
  733.                     Rolls = Total
  734.                     If Total < 10 Then Txt_Result.Text = Txt_Result.Text + "  "
  735.                     If Total < 100 Then Txt_Result.Text = Txt_Result.Text + "  "
  736.                     Txt_Result.Text = Txt_Result.Text + Rolls
  737.                 Txt_Result.Text = Txt_Result.Text + vbNewLine
  738.                 Next N
  739.         End Select
  740.     Next Num
  741. End If
  742. If DieStats.Checked = True Then
  743.     For N = 1 To 1000
  744.         Total = 0
  745.         For O = 1 To (val(Label1(Index).Caption))
  746.             RI = GetRandomInteger(1, Var)
  747.             Total = Total + RI
  748.         Next O
  749.         Roll(Total) = (val(Roll(Total))) + 1
  750.     Next N
  751.     Txt_Result.Text = "I rolled " + Label1(Index).Caption + Label2(Index).Caption + " 1000 times and got the following results:" + vbNewLine
  752.     Txt_Result.Text = Txt_Result.Text + "Number" + vbTab + "# Rolls" + vbTab + "Percent" + vbNewLine
  753.     For RI = ((Label1(Index).Caption) * 1) To ((Label1(Index).Caption) * Var)
  754.         Rolls = RI
  755.         Txt_Result.Text = Txt_Result.Text + "   "
  756.         If RI < 10 Then Txt_Result.Text = Txt_Result.Text + "  "
  757.         Txt_Result.Text = Txt_Result.Text + Rolls
  758.         Txt_Result.Text = Txt_Result.Text + "  "
  759.         Txt_Result.Text = Txt_Result.Text + vbTab + "   "
  760.         If Roll(RI) < 10 Then Txt_Result.Text = Txt_Result.Text + "  "
  761.         If Roll(RI) < 100 Then Txt_Result.Text = Txt_Result.Text + "  "
  762.         Rolls = Roll(RI)
  763.         Per = ((Roll(RI)) / 1000) * 100
  764.         Perc = Per
  765.         Txt_Result.Text = Txt_Result.Text + Rolls + "  "
  766.         Txt_Result.Text = Txt_Result.Text + vbTab + "   "
  767.         If Per < 10 Then Txt_Result.Text = Txt_Result.Text + "  "
  768.         Txt_Result.Text = Txt_Result.Text + Perc + "%" + vbNewLine
  769.     Next RI
  770. End If
  771. End Sub
  772. Private Sub DieRoller_Click()
  773. DieRoller.Checked = True
  774. DieStats.Checked = False
  775. NoofRolls.Enabled = True
  776. End Sub
  777. Private Sub DieStats_Click()
  778. DieStats.Checked = True
  779. DieRoller.Checked = False
  780. NoofRolls.Enabled = False
  781. End Sub
  782. Private Sub Exit_Click()
  783. Unload Me
  784. End Sub
  785. Private Sub Form_Load()
  786. Dim Tittle As String, VerNum As String, Major As String, Minor As String, Revision As String
  787. Major = App.Major
  788. Minor = App.Minor
  789. Revision = App.Revision
  790. VerNum = Major + "." + Minor + Revision
  791. Tittle = App.Title + " "
  792. Form1.Caption = Tittle + VerNum
  793. DefaultDir = App.Path + "\"
  794. End Sub
  795. Private Sub Form_Unload(Cancel As Integer)
  796. End Sub
  797. Private Sub NoRolls_Click(Index As Integer)
  798. Dim Num
  799. For Num = 0 To 10
  800.     NoRolls(Num).Checked = False
  801. Next Num
  802. NoRolls(Index).Checked = True
  803. End Sub
  804. Private Sub Save_Click()
  805. Dim msg As String, Style As String, Title As String, Response, MyString As String
  806. On Error GoTo ErrorTrap:
  807. With CommonDialog1
  808.     .DefaultExt = "txt"
  809.     .DialogTitle = "Save Results As"
  810.     .Filter = "*.txt"
  811.     .FileName = ""
  812.     .ShowSave
  813.     .InitDir = DefaultDir
  814. End With
  815. FileRepExists (FileNames)
  816. Select Case FileRepExists(FileNames)
  817. Case Is = True
  818.     msg = FileNames + " already exists. Do you wish to replace it?" ' Define message.
  819.     Style = vbYesNo + vbExclamation + vbDefaultButton2 ' Define buttons.
  820.     Title = "Save As..."  ' Define title.
  821.     ' Display message.
  822.     Response = MsgBox(msg, Style, Title)
  823.     Select Case Response
  824.     Case Is = vbNo ' User chose Yes.
  825.         Exit Sub
  826.     End Select
  827. End Select
  828. Open (CommonDialog1.FileName) For Output As #1
  829. Print #1, Txt_Result.Text
  830. Close #1
  831. ErrorTrap:
  832. If Err.Number = 32755 Then
  833.     Exit Sub
  834. End If
  835. End Sub
  836.